export interface MemberInfoStore {
  sysUserID: string;
  ISmemberAdmin: boolean;
}

export const memberInfoStore = {
  state: () => {
    const state: MemberInfoStore = {
      sysUserID: localStorage.getItem("sysUserID") || "",
      ISmemberAdmin: JSON.parse(localStorage.getItem("ISmemberAdmin") as string) || false,
    };
    return state;
  },
  mutations: {
    SET_MEMBER_SYSUSERID(state: MemberInfoStore, payload: string) {
      localStorage.setItem("sysUserID", payload);
      state.sysUserID = payload;
    },
    SET_MEMBER_ISADMIN(state: MemberInfoStore, payload: boolean) {
      localStorage.setItem("ISmemberAdmin", JSON.stringify(payload));
      state.ISmemberAdmin = payload;
    },
  },
  getters: {
    sysUserID: (state: MemberInfoStore) => state.sysUserID,
    ISadmin: (state: MemberInfoStore) => state.ISmemberAdmin,
  },
};
